package cn.tedu.submarine;

import javax.swing.ImageIcon;

/**
 * 鱼雷潜艇类
 */
public class TorpedoSubmarine extends SeaObject implements EnemyScore{
    private int torpedoSubmIndex = 0;

    public TorpedoSubmarine(){
        super(96,112);
    }

    public void move(){
        setX(getX() + getSpeed());
    }

    int tIndex = 0;
    int moIndex = 0;
    int boomIndex = 0;
    public ImageIcon getImage() {//画哥布林(潜艇)
        if (isLive()) {
            if (++tIndex % 10 == 0) {
                return Images.torpesubm[torpedoSubmIndex++%4];
            } else {
                return Images.torpesubm[torpedoSubmIndex%4];
            }
        }else {
            if (++moIndex % 10 == 0) {
                boomIndex++;
                if (boomIndex == 10) {
                    setState(REMOVE);
                    return Images.boommap[boomIndex-1];
                }
                return Images.boommap[boomIndex];
            } else {
                return Images.boommap[boomIndex];
            }
        }
    }

    public int getScore(){
        return 20;
    }
}
